package com.fs.ibox.util;

import com.alibaba.fastjson.JSON;
import com.fs.ibox.vo.ResponseData;


import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 响应json数据工具类
 */
public class ResponseJSONUtil {

    public static void responseJSON(ResponseData responseData, HttpServletResponse response) throws IOException {
        if(responseData == null){
            return;
        }
        String str = JSON.toJSONString(responseData);
        PrintWriter out = response.getWriter();
        out.println(str);
        out.flush();
        out.close();
    }

    public static void responseJSON(ResponseData responseData) {
    }
}
